package com.bioroadlab.pojo;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.TableGenerator;

@Entity
@Table(name = "patient", catalog = "bioroadlab")
public class Patient implements java.io.Serializable {

	private static final long serialVersionUID = 1L;
	private Integer sn;
	private String name;
	private String telephone;
	private String mobilePhone;
	private String contact;
	private String address;
	private String father;
	private String mother;
	private String gender;
	private String birthday;
	private String idNumber;
	private String idType;

	private Set<SampleInfo> sampleInfos = new HashSet<SampleInfo>(0);

	// Property accessors
	@TableGenerator(table = "id_generator", pkColumnName = "name", pkColumnValue = "Patient", valueColumnName = "id", name = "generator", allocationSize = 1, initialValue = 1)
	@Id
	@GeneratedValue(generator = "generator", strategy = GenerationType.TABLE)
	@Column(name = "sn", unique = true, nullable = false)
	public Integer getSn() {
		return this.sn;
	}

	public void setSn(Integer sn) {
		this.sn = sn;
	}

	@Column(name = "name", length = 50)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "telephone", length = 50)
	public String getTelephone() {
		return this.telephone;
	}

	public void setTelephone(String telephone) {
		this.telephone = telephone;
	}

	@Column(name = "mobile_phone", length = 50)
	public String getMobilePhone() {
		return this.mobilePhone;
	}

	public void setMobilePhone(String mobilePhone) {
		this.mobilePhone = mobilePhone;
	}

	@Column(name = "contact", length = 50)
	public String getContact() {
		return this.contact;
	}

	public void setContact(String contact) {
		this.contact = contact;
	}

	@Column(name = "address", length = 500)
	public String getAddress() {
		return this.address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	@Column(name = "father", length = 50)
	public String getFather() {
		return this.father;
	}

	public void setFather(String father) {
		this.father = father;
	}

	@Column(name = "mother", length = 50)
	public String getMother() {
		return this.mother;
	}

	public void setMother(String mother) {
		this.mother = mother;
	}

	@Column(name = "gender", length = 2)
	public String getGender() {
		return this.gender;
	}

	public void setGender(String gender) {
		this.gender = gender;
	}

	@Column(name = "birthday", length = 40)
	public String getBirthday() {
		return this.birthday;
	}

	public void setBirthday(String birthday) {
		this.birthday = birthday;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "patient")
	public Set<SampleInfo> getSampleInfos() {
		return this.sampleInfos;
	}

	public void setSampleInfos(Set<SampleInfo> sampleInfos) {
		this.sampleInfos = sampleInfos;
	}

	@Column(name = "id_number", length = 50)
	public String getIdNumber() {
		return idNumber;
	}

	public void setIdNumber(String idNumber) {
		this.idNumber = idNumber;
	}

	@Column(name = "id_type", length = 50)
	public String getIdType() {
		return idType;
	}

	public void setIdType(String idType) {
		this.idType = idType;
	}

}